1. Field of the Invention
The present invention relates to a three-dimensional image processing apparatus, a three-dimensional image processing method, a three-dimensional image processing program, a computer-readable recording medium, and a recording device.
2. Description of Related Art
In a large number of production sites such as factories, there have been introduced image processing apparatuses that realize automatic and fast performance of inspections, which have relied on viewing of humans. The image processing apparatus captures an image of a workpiece that comes flowing through a production line such as a belt conveyor by use of a camera, and executes measurement processing such as edge detection and area calculation for a predetermined region by use of the obtained image data. Then, based on a processing result of the measurement processing, the apparatus performs inspections such as detection of a crack on the workpiece and positional detection of alignment marks, and outputs determination signals for determining the presence or absence of a crack on the workpiece and positional displacement. In such a manner, the image processing apparatus may be used as one of FA (Factory Automation) sensors.
An image which is taken as a measurement processing target by the image processing apparatus that is used as the FA sensor is principally a brightness image not including height information. For this reason, speaking of the foregoing detection of a crack on the workpiece, the apparatus is good at stably detecting a two-dimensional shape of a cracked portion, but having difficulties in stably detecting a three-dimensional shape of, for example, a depression of a flaw which is not apt to appear in a brightness image. For example, it is thought that a type or a direction of illumination that illuminates the workpiece during the inspection is devised and a shade caused by a depression of a flaw is detected to indirectly detect a three-dimensional shape, but a clear shade is not necessarily always detected in the brightness image. In order to prevent an erroneous determination which is to erroneously detect a defective product as a non-defective product at the time of an unclear shade being detected, for example, if a determination threshold is biased to the safe side, the apparatus might determine a large number of non-defective products as defective products, to cause deterioration in production yield.
Accordingly, there is considered a visual inspection which uses not only a brightness image that takes, as a pixel value, a shade value in accordance with a light reception amount of the camera but also a distance image that takes, as a pixel value, a shade value in accordance with a distance from the camera to the workpiece to two-dimensionally express a height (e.g. see Unexamined Japanese Patent Publication No. 2012-21909).
An example of the three-dimensional image processing apparatus is shown in a schematic view of FIG. 160. This three-dimensional image processing apparatus is configured of a head section provided with an image capturing part such as a light reception element, and a controller section which is connected to the head section and is sent image data captured in the head section, to generate a distance image from the acquired image data.
Here, the principle of triangulation will be described based on FIG. 160. In the head section, an angle α between an optical axis of incident light emitted from a light projecting section 110 and an optical axis of reflected light that is incident on a light receiving section 120 (optical axis of the light receiving section 120) is previously set. Here, when the workpiece is not mounted on a workpiece mounting place, incident light emitted from the light projecting section 110 is reflected by a point O on the workpiece mounting surface and is incident on the light receiving section 120. On the other hand, when the workpiece is mounted on the workpiece mounting place, the incident light emitted from the light projecting section 110 is reflected by a point A on the surface of the workpiece and is incident as reflected light on the light receiving section 120. Then, a distance d in an X-direction between the point O and the point A is measured, and based on this distance d, a height h of the point A on the surface of the workpiece is calculated.
Heights of all points on the surface of the workpiece are calculated applying the foregoing the measurement principle of triangulation, thereby to measure a three-dimensional shape of the workpiece. In a pattern projecting method, in order that all the points on the surface of the workpiece are irradiated with incident light, the incident light is emitted from the light projecting section 110 in accordance with a predetermined structured pattern, reflected light as the light reflected on the surface of the workpiece is received, and based on a plurality of received pattern images, the three-dimensional shape of the workpiece is efficiently measured.
As such a pattern projecting method, there are known a phase shift method, a spatial coding method, a multi-slit method and the like. By the three-dimensional measurement processing performed using the pattern projecting method, a projection pattern is changed to repeat image-capturing a plurality of times in the head section, and the images are transmitted to the controller section. In the controller section, computing is performed based on the pattern projected images transmitted from the head section, and a distance image having height information of the workpiece can be obtained.
Generating such a distance image requires a plurality of pattern projected images. Hence it is necessary that, after capturing of a large number of pattern projected images in the head section, these images be once transferred to the controller section side, and computational processing be performed using the plurality of pattern projected images on the controller section side. However, when a large number of image data are transmitted from the head section to the controller section side, a load of data communication increases. Particularly, improving the accuracy requires high-resolution pattern projected image data and also leads to an increase in number of pieces of pattern projected image data. Moreover, in the case of combining a plurality of methods such as the phase shift method and the spatial coding method for the purpose of improving the accuracy in height information, the number of captured images further increases and an amount of data to be transmitted from the head section to the controller section also increases. This makes the time required for data transfer longer and thus makes real-time processing difficult to perform. Besides, high-speed communication is necessary for making communication of a large amount of data performed in a short period of time, thus causing a problem of severe specification requirements in terms of hardware and cost increase.